home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 30
/
Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso
/
Aminet
/
comm
/
net
/
AmiMUD.lha
/
AmiMUD
/
rexx
/
example.amud
< prev
next >
Wrap
Text File
|
1996-09-20
|
3KB
|
122 lines
/* Test script */
/* Note that often you have to pass the parameters with DOUBLE quotes
* if these contains spaces.
*/
address 'AmiMUD.1'
am_echo '" "'
am_echo '" "'
am_echo '"Welcome to the AmiMUD rexx example!!!"'
am_echo '"-------------------------------------"'
am_echo '" "'
am_echo '" "'
am_getscreen
am_echo '"AmiMUD screen (example of am_waitfor):' SCREENNAME '"'
say 'AmiMUD screen: ' SCREENNAME
am_echo '" "'
am_echo '"Waiting for text: Reception (example of am_waitfor)."'
am_echo '"Use #send to simulate it if you are not connected."'
am_waitfor "Reception"
am_echo '"Line received (variable linebuffer):' LINEBUFFER '"'
say 'Line received:' LINEBUFFER
am_echo '" "'
am_echo '"Now I''ll define TWO rexxtriggers, their use is in conjunction"'
am_echo '"With the potions REXXONLY of am_waittriggers"'
am_addtrigger 'hello' '"#echo Hello world\n"' REXXTRIGGER
am_echo '"Defined hello, trigger number:' TRIGGER '"'
/* Save the value for further use... */
hello_trig=TRIGGER
am_addtrigger '"goodbye"' '"#echo Goodbye!\n"' REXXTRIGGER
am_echo '"Defined goodbye, trigger number:' TRIGGER '"'
/* Save the value for further use... */
goodbye_trig=TRIGGER
am_echo '" "'
am_echo '"Now I''ll wait for a trigger, anyone is good, also if defined in the"'
am_echo '"configuration or through the Add Macro menu."'
am_echo '"Use #send to simulate it if you are not connected."'
am_waittriggers
say 'Line received:' LINEBUFFER 'trigger:' TRIGGER
am_echo '"The activated trigger is number:' TRIGGER 'line:' LINEBUFFER '"'
am_echo '" "'
am_echo '"Now I''ll wait for a REXXTRIGGER, actually there are only"'
am_echo '"two defined rexxtriggers: hello and goodbye"'
am_waittriggers REXXONLY
am_echo '"The activated trigger is number:' TRIGGER 'line:' LINEBUFFER '"'
say 'Line received:' LINEBUFFER 'trigger:' TRIGGER
am_echo '" "'
am_echo '"Ok, now I''ll set a variable, variable 1 will be <Gabriele Greco>"'
am_setvar 1 '"Gabriele Greco"'
am_echo '"Now I''ll create a macro that use variable 1, then I''ll execute it."'
am_addmacro 'tempmacro' '"#echo Variable 1 is $1\n"'
am_echo '"Type <#send ready> and I''ll execute the macro."'
am_waitfor 'ready'
am_send '#tempmacro'
am_echo '" "'
am_echo '"Ok, now I''ll get variable $2, set it to something intresting and then"'
am_echo '"<#send ready> and I''ll get the variable"'
am_waitfor 'ready'
am_getvar 2 PROVA
am_echo '"Ok, variable $2 was:' PROVA '"'
am_echo '" "'
am_echo '" "'
am_echo '"And now a simple loop..."'
am_echo '"If you will select the trigger hello (for instance with <#send hello>)"'
am_echo '"This script will quit and ALSO AmiMUD will quit."'
am_echo '" "'
am_echo '"If you select the trigger goodbye (for instance with <#send goodbye>)"'
am_echo '"ONLY the script will quit but AmiMUD will remain active."'
TRIGGER=0;
do while TRIGGER<>goodbye_trig
waittriggers;
if TRIGGER=hello_trig then am_quit
end;
am_echo '"You have selected to keep alive AmiMUD, ok, use #rx or the menu option"'
am_echo '"to start a script more useful than me :) Please note that you can include"'
am_echo '"#rx in macros, so you can also execute arexx script with hotkeys."'.